package org.apache.struts.ehr.patient_details.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.ehr.medical_records.model.ChangeConsultant;
import org.apache.struts.ehr.medical_records.model.HL7Message;
import org.apache.struts.ehr.medical_records.model.ReplyMessage;
import org.apache.struts2.interceptor.ServletRequestAware;

import ca.uhn.hl7v2.model.v251.message.ACK;
import ca.uhn.hl7v2.model.v251.message.ADR_A19;
import ca.uhn.hl7v2.model.v251.message.ADT_A61;
import ca.uhn.hl7v2.model.v251.segment.PID;
import ca.uhn.hl7v2.model.v251.segment.PV1;

import com.earogya.communicate.Communicator;
import com.earogya.logic.medical_records.CreateADTA08;
import com.earogya.logic.medical_records.CreateADTA61;
import com.earogya.logic.medical_records.ParseReply;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class MergeSearchAction extends ActionSupport{

	private int patientId1;


	
	public int getPatientId1() {
		return patientId1;
	}

	public void setPatientId1(int patientId1) {
		this.patientId1 = patientId1;
	}

	public String execute()throws Exception{
		/*Map<String, Object> session=ActionContext.getContext().getSession();
		replyMessage=new ReplyMessage();
		replyMessage.setMessage("empty");
		CreateADTA61 createMessage=new CreateADTA34(patient);
		String msg=createMessage.createMessage("CSTH");
		if(!msg.equals(null)){
			Communicator c=new Communicator();
			String reply=c.sendMessage(msg);
			if(!reply.equals("No Reply")){
				ParseReply parse=new ParseReply();
				replyMessage=(ReplyMessage)parse.parseMessage(reply);
			}
		}*/
		
		System.out.print(patientId1);
		return SUCCESS;
	}
	
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

		request.setAttribute("patient_id1", patientId1);
		
		return true;
		}
	
	public void validate(){
		
	}
}
